#ifndef __TOUCH_H__
#define __TOUCH_H__

#include "i2c_driver.h"
#include "esp_log.h"
#include "driver/i2c.h"
#include "capacitive_hynitron_cst816t_update.h"

#define I2C_MASTER_SCL_IO           15      /*!< GPIO number used for I2C master clock */
#define I2C_MASTER_SDA_IO            16     /*!< GPIO number used for I2C master data  */
#define I2C_MASTER_NUM              0                          /*!< I2C master i2c port number, the number of i2c peripheral interfaces available will depend on the chip */
#define I2C_MASTER_FREQ_HZ          100000                     /*!< I2C master clock frequency */
#define I2C_MASTER_TX_BUF_DISABLE   0                          /*!< I2C master doesn't need buffer */
#define I2C_MASTER_RX_BUF_DISABLE   0                          /*!< I2C master doesn't need buffer */
#define I2C_MASTER_TIMEOUT_MS       1000

#define MPU9250_SENSOR_ADDR                 0x6a       /*!< Slave address of the MPU9250 sensor */
#define MPU9250_WHO_AM_I_REG_ADDR           0x75        /*!< Register addresses of the "who am I" register */

#define MPU9250_PWR_MGMT_1_REG_ADDR         0x6B        /*!< Register addresses of the power managment register */
#define MPU9250_RESET_BIT                   7
#define TP_RST                      17  
#define TP_INT                      18
#define TP_ADDR                     0x15
#define GPIO_INPUT_IO_0             TP_INT
#define GPIO_INPUT_PIN_SEL          (1ULL<<GPIO_INPUT_IO_0) 
#define ESP_INTR_FLAG_DEFAULT 0


struct indev_t{
    uint16_t x_coordinate;
    uint16_t y_coordinate;
    int touch_status;
};

void cts816tInit(void);
int GetTpIsTouch(void);
void  GetTpPositon(int16_t *x,int16_t *y);
#endif